import psutil
import cmdrun
def inspect_power():#检查外接
    battery = psutil.sensors_battery()  # 获取电池的参数
    plugged = battery.power_plugged  # 查看是否有外接电源
    return plugged#返回外接状态

def check_battery():#检查电池余量
    battery = psutil.sensors_battery()  # 获取电池的参数
    percent = battery.percent  # 查看电池剩余量
    return percent#返回电池余量